<?php

include_once "xAP-functions/webincludes.php";

$ip=$_SERVER["REMOTE_ADDR"];


$sql="select ColumnRef,Widget from xAP_Widget_Location
where IP='".$ip."'
order by ColumnRef,WidgetOrder";

$results=dbquery($sql);
$i=0;
foreach($results as $row){
	$col["col".$row["ColumnRef"]][]="/".$row["Widget"].".php?ref=".$i;
	$i++;
}





echo "{\n";

foreach($col as $key=>$value){

	echo "\"".$key."\": [\"";
	echo implode("\",\"",$value);
	echo "\"], \n";
}



echo "
\"status\":[1]}\n";
?>